Skip to content

Key cache entries by Podman hex secret ID, not human-readable name#29

Merged
jdoss merged 1 commit intomasterfrom
fix/cache-key-uses-secret-id
Apr 16, 2026
Merged

Key cache entries by Podman hex secret ID, not human-readable name#29
jdoss merged 1 commit intomasterfrom
fix/cache-key-uses-secret-id

Conversation

@jdoss
Copy link
Copy Markdown
Contributor

@jdoss jdoss commented Apr 16, 2026

Summary

Setup populated the encrypted cache with keys like atuin--POSTGRES_PASSWORD but the serve lookup path receives the Podman hex secret ID in $SECRET_ID (e.g. 40ba10c50224daba166308fbc). The cache.get() call in serve never matched, so the cache has never served a single hit — every lookup always went to the live provider.

Same class of bug as the dry-run fix in PR #28: Podman identifies secrets by hex ID internally, not by human-readable name.

The cache exists specifically to serve secrets when the upstream provider is down. In its first real-world test (Infisical down during a container restart cascade on the test server), it failed silently — every Infisical-backed lookup returned a provider error instead of the cached value.

Fix: _register_secrets now returns a {key: hex_id} map from the Podman API's create response. The caller uses hex IDs as cache keys so serve's cache.get(secret_id) finds the right entry.

Test plan

  • pytest tests/test_setup.py — new TestRegisterSecretsIdMap verifies _register_secrets returns the hex ID from the Podman API response.
  • ruff check / ruff format --check / ty check — clean.
  • Deploy to test server, run psi setup, verify psi cache status --verify shows entry count, then restart psi-secrets and confirm cache hits in the journal.

Setup populated the encrypted cache with keys like
"atuin--POSTGRES_PASSWORD" but the serve lookup path receives the
Podman hex secret ID in $SECRET_ID (e.g. "40ba10c50224daba166308fbc").
The cache.get() call in serve never matched, so the cache never served
a single hit — every lookup always went to the live provider.

This is the same class of bug as the dry-run fix in PR #28: Podman
identifies secrets by hex ID internally, not by human-readable name.

The cache exists specifically to serve secrets when the upstream
provider is down. In its first real-world test (Infisical down during
a container restart cascade), it failed silently — every Infisical-
backed lookup returned a provider error instead of the cached value.

Fix: _register_secrets now returns a {key: hex_id} map from the Podman
API's create response. The caller uses hex IDs as cache keys so
serve's cache.get(secret_id) finds the right entry.
@jdoss jdoss merged commit 71fbc7e into master Apr 16, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant